home *** CD-ROM | disk | FTP | other *** search
- #include "DemoRoutines.h"
-
- long GWGet32PixelC( GWorldPtr src, short x, short y )
- {
- PixMapHandle srcPixMap;
- unsigned short srcRowBytes;
- long srcBaseAddr;
- long srcAddr;
- char mmuMode;
- long result;
-
- srcPixMap = GetGWorldPixMap( src );
- srcBaseAddr = (long) GetPixBaseAddr ( srcPixMap ); /* get the address of the pixmap */
- srcRowBytes = (**srcPixMap).rowBytes & 0x7fff; /* get the row increment */
-
- /* Make bounds pixmap relative */
-
- x -= (**srcPixMap).bounds.left;
- y -= (**srcPixMap).bounds.top;
- mmuMode = true32b;
- SwapMMUMode ( &mmuMode ); /* set the MMU to 32-bit mode */
-
- /* Calculate the address of the pixel: base + y*(row size in bytes) + x*(bytes/pixel) */
-
- srcAddr = srcBaseAddr + (long)y*srcRowBytes + (x<<2);
- result = *(long*)srcAddr;
- SwapMMUMode ( &mmuMode ); /* restore the previous MMU mode */
- return( result );
- }
-
- void GWSet32PixelC( GWorldPtr src, short x, short y, long pixelValue )
- {
- PixMapHandle srcPixMap;
- unsigned short srcRowBytes;
- long srcBaseAddr;
- long srcAddr;
- char mmuMode;
-
- srcPixMap = GetGWorldPixMap( src );
- srcBaseAddr = (long) GetPixBaseAddr ( srcPixMap ); /* get the address of the pixmap */
- srcRowBytes = (**srcPixMap).rowBytes & 0x7fff; /* get the row increment */
-
- /* Make bounds pixmap relative */
-
- x -= (**srcPixMap).bounds.left;
- y -= (**srcPixMap).bounds.top;
-
- mmuMode = true32b;
- SwapMMUMode ( &mmuMode ); /* set the MMU to 32-bit mode */
-
- /* Calculate the address of the pixel: base + y*(row size in bytes) + x*(bytes/pixel) */
-
- srcAddr = srcBaseAddr + (long)y*srcRowBytes + (x<<2);
- /* Debugger(); /* mikey */
- *((long *)srcAddr) = pixelValue;
- SwapMMUMode ( &mmuMode ); /* restore the previous MMU mode */
- }
-
-